Support scrolling with page up and page down.#267
Support scrolling with page up and page down.#267Lukas-Stuehrk wants to merge 2 commits intosimonbs:macfrom
Conversation
simonbs
left a comment
There was a problem hiding this comment.
@Lukas-Stuehrk Thanks for taking the time to create this PR.
Unfortunately, implementing support for scrolling a page up and down is a bit more elaborate than what's initially suggested in this PR.
Runestone will only typeset and layout the lines that are within the viewport unless it is explicitly asked to layout more lines. The content size is not correct until all lines have been laid out. A consequence of this is that we need to explicitly layout the lines within the rect to scroll to using the LayoutManager.
The issue is illustrated in the video below. Notice that when attempting to scroll a page down, the text is sometimes only scrolled a few hundred pixels.
video.mov
6f73a2f to
ea047f3
Compare
|
@simonbs Sorry, my bad. I was kind of expecting this, but when I tested it, I only tested with edited files and did not catch it. I updated the implementation and it should work now. There's one thing which is rather inelegant: Runestone/Sources/Runestone/TextView/Core/Mac/TextView_Mac.swift Lines 787 to 788 in ea047f3 I'm reading the scrollview's content size instead of using the |
|
@Lukas-Stuehrk Thanks for revisiting these changes. I'm afraid that there are still some issues though. See the attached video. From seconds 7 to 8, I attempt to scroll a page down but it only scrolls 2/3 of a page down or so. I'm afraid that the changes needed are quite elaborate, however, I have an idea as to how it can be implemented. I'll be happy to have a look at this a bit further down the road when a few more of the basics in the Mac app are in place 😊 video.mov |
Not
deleteToEndOfParagraph:yet ;)This change implements scrolling via the
page upandpage downkeys. The behavior is the same like in standard text views on macOS: it only scrolls the contents, but doesn't move the cursor.